import Vue from 'vue'
import Router from 'vue-router'
import newComing from '../components/top/newcoming/newComing.vue'
import clothe  from '../components/top/clothe/clothe.vue'
import path  from '../components/top/path/path.vue'
import pathGoods from '../components/top/path/pathGoods.vue'
import shops  from '../components/top/shops/shops.vue'
import shopsGoods  from '../components/top/shops/shopsGoods.vue'
import bag  from '../components/top/bag/bag.vue'
import firstpage from '../components/firstPage/firstPage.vue'
import  other from '../components/top/other/other.vue'
import CreateUser from '../components/firstPage/CreateUser.vue'
import login from '../components/firstPage/login.vue'
import rollsale1 from '../components/firstPage/rollSale/rollsale1.vue'
import clothesGoods from '../components/top/clothe/clothesGoods.vue'
import SizeImg from '../components/footer/SizeImg.vue'
import SizeText from '../components/footer/SizeText.vue'
import logo from '../components/top/logo/logo.vue'
import bagGoods from '../components/top/bag/bagGoods.vue'
import shopCar from '../components/top/shopCar/shopCar.vue'
import aboutMe from '../components/aboutMe/aboutMe.vue'
import talkToUs from '../components/talkToUs/talkToUs.vue'

Vue.use(Router)

export default new Router({
	// 解决路由跳转置顶
	scrollBehavior ( to,from,savedPosition) {
           if(savedPosition) {
			   return savedPosition
		   }else {
			    return {x:0 , y:0}
		   }
	},
  routes: [
    {
    	path: '/',
    	redirect: '/firstpage'
    },
    {
    	path: '/firstpage',
    	name: firstpage,
    	component: firstpage
    },
    {
    	path: '/newComing',
    	name: newComing,
    	component: newComing
    },
    {
    	path: '/clothe',
    	name: clothe,
    	component: clothe
    },
    {
    	path: '/path',
    	name: path,
    	component: path
	},
	{
		path: '/pathGoods/:id',
		name: pathGoods,
		component: pathGoods
	},
    {
    	path: '/shops',
    	name: shops,
    	component: shops
	},
	{
		path: '/shopsGoods/:id',
		name: shopsGoods,
		component: shopsGoods,
		props: true
	},
    {
    	path: '/bag',
    	name: bag,
    	component: bag
	},
	{
		path: '/bagGoods/:id',
		name:bagGoods,
		component: bagGoods
	}
    ,{
    	path: '/other',
    	name: other,
    	component: other
    },
    {
    	path: '/createUser',
    	name:CreateUser,
    	component: CreateUser
    },
    {
    	path: '/login',
    	name: login,
    	component: login
	},
	{
		path: '/rollsale1',
		name:rollsale1,
		component:rollsale1
	},
	// 动态路由匹配
	{
		path: '/clothesGoods/:id',
		component: clothesGoods,
		props:true
	},
	// 尺码提示路由
	{
		path: '/SizeImg',
		name: SizeImg,
		component:SizeImg
	}
	// 尺码文字提示
	,{
		path:  '/SizeText',
		component:SizeText
	},
	{
		path: '/logo',
		component:logo
	},
	{
		path: '/shopcar',
		component: shopCar
	},
	{
		path: '/aboutMe',
		name:aboutMe,
		component: aboutMe
	},
	{
		path: '/talkToUs',
		name: talkToUs,
		component: talkToUs
	}
  ]
})
